﻿namespace Er
{
    using System;
    using System.Collections.Generic;

    using Shared.Models;

    public class WordRepository : IWordRepository
    {
        private readonly IErLibContainer _erLibContainer;

        public WordRepository(IErLibContainer erLibContainer)
        {
            _erLibContainer = erLibContainer;
        }

        public IEnumerable<Word> GetWords()
        {
            return _erLibContainer.Words;
        }

        public void Add(Word word)
        {
            _erLibContainer.Words.AddObject(word);
        }

        public void Save()
        {
            _erLibContainer.SaveChanges();
        }
    }
}